import { createRouter, createWebHistory } from "vue-router";
import login from "../views/login/login.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "login",
      component: login,
      meta: {
        title: "布局",
      },
      children: [
        {
          path: "/home",
          name: "home",
          component: () => import("../views/home/home.vue"),
          meta: {
            title: "首页",
          },
        },
        {
          path: "/system",
          name: "system",
          meta: {
            title: "系统管理",
          },
          children: [
            {
              path: "/system/menu",
              name: "menu",
              component: () => import("../views/system/menu.vue"),
              meta: {
                title: "菜单管理",
              },
            },
            {
              path: "/system/role",
              name: "role",
              component: () => import("../views/system/role.vue"),
              meta: {
                title: "角色管理",
              },
            },
            {
              path: "/system/user",
              name: "user",
              component: () => import("../views/system/user.vue"),
              meta: {
                title: "用户管理",
              },
            },
          ],
        },
        {
          path: "/goods",
          name: "goods",
          meta: {
            title: "商品管理",
          },
          children: [
            {
              path: "/goods/list",
              name: "list",
              component: () => import("../views/goods/list.vue"),
              meta: {
                title: "商品列表",
              },
            },
            {
              path: "/goods/category",
              name: "category",
              component: () => import("../views/goods/category.vue"),
              meta: {
                title: "商品分类",
              },
            },
          ],
        },
        {
          path: "/jiyun",
          name: "jiyun",
          component: () => import("../views/jiyun/jiyun.vue"),
          meta: {
            title: "积云官网",
          },
        },
        {
          path: "/401",
          name: "401",
          component: () => import("../views/401/401.vue"),
          meta: {
            title: "401页面",
          },
        },
        {
          path: "/404",
          name: "404",
          component: () => import("../views/404/404.vue"),
          meta: {
            title: "未找到此页面",
          },
        },
      ],
    },
  ],
});

export default router;
